/******************************************************************************
 *                  Shanghai ChipON Micro-Electronic Co.,Ltd
 ******************************************************************************
 *  @File Name        : DELAY.h
 *  @Author           : ChipON AE/FAE Group
 *  @Date             : 2023-12-19
 *  @HW Version       : KF8A100Fxx
 *  @Lib Version      : V2.0.1
 *  @Description      : This file provides the software delay function
 ******************************************************************************
 *  Copyright (C) by Shanghai ChipON Micro-Electronic Co.,Ltd
 *  All rights reserved.
 *
 *  This software is copyright protected and proprietary to
 *  Shanghai ChipON Micro-Electronic Co.,Ltd.
 *****************************************************************************/
/******************************************************************************
 *  |Date        |Version  |Author       |Description
 ******************************************************************************
 *  |2023-12-25  |V2.0     |Wang Junxiong|New creat
 *****************************************************************************/

#ifndef DELAY_H
#define DELAY_H

#ifdef __cplusplus
extern "C" {
#endif

/******************************************************************************
 *                      Include Files
 *****************************************************************************/
#include "kf8a100fxx.h"
/******************************************************************************
 *                      Macro or Inline
 *****************************************************************************/

/*****************************************************************************
 *                      Typedef Definitions
 *****************************************************************************/

/******************************************************************************
 *                      Export Variables
 *****************************************************************************/

/******************************************************************************
 *                      Export Functions
 *****************************************************************************/

/**
 * @brief Delay 2us. Use the instruction to delay a fixed amount of time, effectively the minimum time to call an empty
 * function.
 *
 * @details The lower the system clock frequency, the longer the timing period, the specific crystal frequency and
 * timing period of the corresponding relationship is as follows
 * 16M-2us
 * 8M-4us
 * 4M-8us
 * 2M-16us
 * ......
 * Other cases are in the same order
 */
void Delay_2us_loop(void);

/**
 * @brief Delay n*10us. Use the command delay for a fixed amount of time, actually the minimum time to call some empty
 * function
 *
 * @details The lower the system clock frequency, the longer the timing period, the specific crystal frequency and
 * timing period of the corresponding relationship is as follows
 * 16M-10us
 * 8M-20us
 * 4M-40us
 * 2M-80us
 * ......
 * Other cases are in the same order
 *
 * @param n_10us n*10us
 */
void Delay_10us_loop(uint16_t n_10us);

/**
 * @brief Delay n*1ms. Use the command delay for a fixed amount of time, actually the minimum time to call some empty
 * function
 *
 * @details The lower the system clock frequency, the longer the timing period, the specific crystal frequency and
 * timing period of the corresponding relationship is as follows
 * 16M-1ms
 * 8M-2ms
 * 4M-4ms
 * 2M-8ms
 * ......
 * Other cases are in the same order
 *
 * @param n_ms n*1ms
 */
void Delay_ms_loop(uint16_t n_ms);

#ifdef __cplusplus
}
#endif

#endif
/* EOF */
